package com.zm.shop.controller;

import com.zm.shop.service.Impl.GoodsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/search")
public class SearchGoodsController {

    @Autowired
    private GoodsServiceImpl goodsServiceImpl;

    @RequestMapping("/searchGoods")
    public String searchGoods(@RequestParam Map<String,Object> param, ModelMap modelMap) throws IOException {
        List<Map<String, Object>> goodsMapList = goodsServiceImpl.search(param);
        modelMap.put("goodsMapList",goodsMapList);
        return "searchList";
    }
}
